import { request } from "./request"
export function Userinfo() {
  // const model = { email: email, password: password }
  // console.log(token);
  return request({
    method: 'get',
    url: '/api/user',
    // headers: {
    //   'Authorization': 'Bearer' + token
    // }
  })
}
/* 上传头像 */
export function Upload(avatar) {
  console.log(avatar);
  return request({
    method: 'PATCH',
    url: '/api/user/avatar',
    data: avatar
  })
}

/* 修改姓名 */
export function Upname(name) {
  console.log(name);
  return request({
    method: 'put',
    url: '/api/user',
    data: { name }
  })
}

/* 修改密码 */
export function Uppwd(old_password, password, password_confirmation) {
  // console.log(old_password, password, password_confirmation);
  const obj = {
    'old_password': old_password,
    'password': password,
    'password_confirmation': password_confirmation
  }
  console.log(obj);
  return request({
    method: 'post',
    url: '/api/auth/password/update',
    data: obj
  })
}